(defun p6 (n)
  (- (squares-of-sum n)
	 (sum-of-squares n)))

(defun sum-of-squares (n)
  (apply
	'+
	(mapcar
	  'squares
	  (range 1 n))))

(defun squares-of-sum (n)
  ((lambda (x) (squares x))
	(apply
	  '+
	  (range 1 n))))

(defun range (start end)
        (loop for i from start to end collect i)) 

(defun squares (n)
  (expt n 2))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(format t "~a~%" (range 1 10))
(format t "~a~%" (sum-of-squares 10))
(format t "~a~%" (squares-of-sum 10))
(format t "~a~%" (p6 100))
